package com.yikaiye.android.yikaiye.di.retrofit;

import com.yikaiye.android.yikaiye.http.ApiFactory;
import com.yikaiye.android.yikaiye.http.HttpRespond;
import com.yikaiye.android.yikaiye.model.AlipayModel;
import com.yikaiye.android.yikaiye.model.BannerModel;
import com.yikaiye.android.yikaiye.model.CheckComboResponseModel;
import com.yikaiye.android.yikaiye.model.CommitOrderResultModel;
import com.yikaiye.android.yikaiye.model.CompanyRecordsModel;
import com.yikaiye.android.yikaiye.model.CustomerServiceModel;
import com.yikaiye.android.yikaiye.model.FddModel;
import com.yikaiye.android.yikaiye.model.HomeIconStatusModel;
import com.yikaiye.android.yikaiye.model.InvoiceDetailsModel;
import com.yikaiye.android.yikaiye.model.InvoiceRecordsModel;
import com.yikaiye.android.yikaiye.model.MessageRecordsModel;
import com.yikaiye.android.yikaiye.model.OrderDataModel;
import com.yikaiye.android.yikaiye.model.OrderProductModel;
import com.yikaiye.android.yikaiye.model.OrderProgressModel;
import com.yikaiye.android.yikaiye.model.ProductDataModel;
import com.yikaiye.android.yikaiye.model.ProductDetailDataModel;
import com.yikaiye.android.yikaiye.model.ServiceDetailsModel;
import com.yikaiye.android.yikaiye.model.ServiceRecordsModel;
import com.yikaiye.android.yikaiye.model.TypeModel;
import com.yikaiye.android.yikaiye.model.UserModel;
import com.yikaiye.android.yikaiye.model.VerifyCodeModel;
import com.yikaiye.android.yikaiye.model.VersionModel;
import com.yikaiye.android.yikaiye.model.company.CompanyIntroModel;
import com.yikaiye.android.yikaiye.model.company.GsBaseInfoModel;
import com.yikaiye.android.yikaiye.model.company.GsChangeRecordDataModel;
import com.yikaiye.android.yikaiye.pay.WeChatInfoModel;

import java.util.List;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiConstants {

    boolean isRelease = false;

    /**
     * 接口地址
     */
    String BASE_SERVER = isRelease ? "https://c-app-api.yikaiye.com" : "https://uat-service.yikaiye.com";

    /**
     * 图片地址
     */
    String BASE_IMAGE_URL = isRelease ? "https://i.yikaiye.com" : "https://d.yikaiye.com";
    /**
     * 图片正式地址
     */
    String BASE_IMAGE_RELEASE_URL = "https://i.yikaiye.com";
    /**
     * pdf地址
     */
    String BASE_PDF_URL = isRelease ? "https://i.yikaiye.com" : "https://d.yikaiye.com";

    /**
     * 版本更新
     */
    @GET("/api/yky/app/common/version")
    Flowable<BaseModel<VersionModel>> checkVersion();

    /**
     * 查询预订单 type 预订单2
     */
    @GET("/api/yky/app/order-new?page=1&size=1&type=2")
    Flowable<BaseModel<OrderDataModel>> getOrderList();

    /**
     * 获取用户专属客服
     */
    @GET("/api/yky/app/common/getCustomerService")
    Flowable<BaseModel<List<CustomerServiceModel>>> getCustomerService();

    /**
     * 产品分类
     */
    @POST("/api/yky/app/product-info/label/list")
    Flowable<BaseModel<TypeModel>> getTypeList(@Body RequestBody requestBody);

    /**
     * 产品列表
     */
    @POST("/api/yky/app/product-info/select/product/list")
    Flowable<BaseModel<ProductDataModel>> getProductList(@Body RequestBody requestBody);

    /**
     * 首页开票入口状态
     */
    @GET("/api/yky/app/invoiceApply/selectButtonByPhone")
    Flowable<BaseModel<HomeIconStatusModel>> getHomeIconStatus();

    /**
     * 个人信息
     */
    @GET("/api/yky/app/userInfo/findByUserId/{id}")
    Flowable<BaseModel<UserModel>> getUserInfo(@Path("id") String id);

    /**
     * 查询订单--提交订单(POST) / 查询订单(GET)
     *
     * @param status 订单状态，0：待付款，1：已付款，2：已取消，3：已退款，4：超时
     */
    @GET("/api/yky/app/order-new")
    Flowable<BaseModel<OrderDataModel>> getOrderList(@Query("status") String status, @Query("page") int page, @Query("size") int size);

    /**
     * 取消订单
     */
    @GET("/api/yky/app/order-new/cancelOrder/{id}")
    Flowable<BaseModel<String>> cancelOrder(@Path("id") String id);

    /**
     * 查看合同
     */
    @POST("/api/yky/app/fdd/signContract/view/{orderNo}?platform=2&source=1")
    Flowable<BaseModel<FddModel>> lookView(@Path("orderNo") String orderNo);

    /**
     * 查看认证结果
     */
    @GET("/api/yky/app/fdd/identityVerify/queryNew?platform=2&source=1")
    Flowable<BaseModel<FddModel>> queryVerifyResult(@Query("orderNo") String orderNo, @Query("customerType") int customerType);

    /**
     * 签署协议
     */
    @POST("/api/yky/app/fdd/signContract/sign/{orderNo}?platform=2&source=1")
    Flowable<BaseModel<FddModel>> signContract(@Path("orderNo") String orderNo, @Query("customerType") int customerType);

    /**
     * 法大大实名认证
     * platform：登录平台（0-易开业_微信, 1-易开业_IOS, 2-易开业_安卓, 3-易开业_PC, 4-易开业_小程序,5- 进价网,
     * 6-易创_IOS, 7-易创_安卓, 8-易创_微信）
     * source：数据源 （1）
     */
    @POST("/api/yky/app/fdd/identityVerify/verifyNew")
    Flowable<BaseModel<FddModel>> realNameVerify(@Body RequestBody requestBody);

    /**
     * 重新实名认证
     */
    @POST("/api/yky/app/fdd/identityVerify/verifyNew/reset")
    Flowable<BaseModel<FddModel>> resetVerify(@Body RequestBody requestBody);

    /**
     * 提交订单
     */
    @POST("/api/yky/app/order-new")
    Flowable<BaseModel<CommitOrderResultModel>> commitOrder(@Body RequestBody requestBody);

    /**
     * 订单详情
     */
    @GET(ApiFactory.GET_ORDER_DETAILS + "{id}")
    Flowable<BaseModel<OrderProductModel>> getOrderDetails(@Path("id") String id);

    /**
     * 微信预支付接口
     */
    @POST("/api/yky/app/order-new/{order-id}/pay/unified-order/{pay-platform}/{pay-code}")
    Flowable<BaseModel<WeChatInfoModel>> getWeChatPay(@Path("order-id") String orderId, @Path("pay-platform") String payPlatform, @Path("pay-code") String payCode, @Body RequestBody requestBody);

    /**
     * 支付宝接口
     */
    @POST("/api/yky/app/order-new/{order-id}/pay/unified-ali-order/{pay-platform}/{pay-code}")
    Flowable<BaseModel<AlipayModel>> getAliPay(@Path("order-id") String orderId, @Path("pay-platform") String payPlatform, @Path("pay-code") String payCode, @Body RequestBody requestBody);

    /**
     * 产品详情
     */
    @GET("/api/yky/app/product-info/select/product/detail/{id}")
    Flowable<BaseModel<ProductDetailDataModel>> getProductDetails(@Path("id") String id);

    /**
     * 首页轮播图
     */
    @GET("https://uat-service.yikaiye.com/operation/api/operation/ignore-auth/official/getBannerList")
    Flowable<BaseModel<List<BannerModel>>> getBanner(@Query("showPosition") int showPosition);

//    /**
//     * 消息列表
//     */
//    @GET("/api/yky/app/message/findMessageByUserid/{uid}")
//    Flowable<BaseModel<List<MessageRecordsModel.MessageModel>>> getMessageList(@Path("uid") String userId);

    /**
     * 消息列表(新)
     */
    @POST("/api/yky/app/message/listMessage")
    Flowable<BaseModel<MessageRecordsModel>> getMessageList(@Body RequestBody requestBody);


    /**
     * 全部标为已读
     */
    @GET("/api/yky/app/message/updateAllMessageStatus/{uid}")
    Flowable<BaseModel<String>> allReady(@Path("uid") String userId);

    /**
     * 删除消息
     */
    @GET("/api/yky/app/message/delMessageById/{id}")
    Flowable<BaseModel<String>> deleteMessage(@Path("id") String id);

    /**
     * 上传图片
     */
    @Multipart
    @POST("/api/yky/app/common/upload")
    Flowable<BaseModel<String>> uploadImage(@Part MultipartBody.Part imagePart);

    /**
     * 修改个人信息
     */
    @POST("/api/yky/app/userInfo/UpdateUserDetail")
    Flowable<BaseModel<String>> updateUserInfo(@Body RequestBody requestBody);

    /**
     * 工商信息
     */
    @GET("/api/yky/app/enterpriseInfo/basicInfo/{eid}")
    Flowable<BaseModel<GsBaseInfoModel>> getGsBaseInfo(@Path("eid") String eid);

    /**
     * 工商变更记录
     */
    @POST("/api/yky/app/enterpriseInfo/basicInfo/getChangeRecord")
    Flowable<BaseModel<GsChangeRecordDataModel>> getGsChangeRecord(@Body RequestBody requestBody);

    /**
     * 发送账号合并验证码
     */
    @GET("/api/yky/app/userInfo/sendSmsCode/{phone}")
    Flowable<BaseModel<String>> sendSmsCode(@Header("x-user-id") String userId, @Path("phone") String phone);

    /**
     * 提交绑定合并
     */
    @POST("/api/yky/app/userInfo/bindingPhone")
    Flowable<BaseModel<String>> bindingPhone(@Body RequestBody requestBody);

    /**
     * 服务列表
     */
    @POST("/api/yky/app/serviceInfo/listServiceInfo")
    Flowable<BaseModel<ServiceRecordsModel>> getServiceList(@Body RequestBody requestBody);

    /**
     * 获取服务详情
     */
    @POST("/api/yky/app/serviceInfo/getServiceDetails")
    Flowable<BaseModel<ServiceDetailsModel>> getServiceDetails(@Body RequestBody requestBody);

    /**
     * 查找企业详情
     */
    @POST("/api/yky/app/enterpriseInfo/getEnterpriseDetail")
    Flowable<BaseModel<CompanyIntroModel>> getCompanyDetail(@Body RequestBody requestBody);

    /**
     * 发票列表
     */
    @POST("/api/yky/app/serviceInfo/listInvoiceContent")
    Flowable<BaseModel<InvoiceRecordsModel>> getInvoiceList(@Body RequestBody requestBody);

    /**
     * 发票详情
     */
    @POST("/api/yky/app/serviceInfo/getInvoiceContentDetail")
    Flowable<BaseModel<InvoiceDetailsModel>> getInvoiceDetails(@Body RequestBody requestBody);

    /**
     * 查找我的企业
     */
    @POST("/api/yky/app/enterpriseInfo/listMyEnterprise")
    Flowable<BaseModel<CompanyRecordsModel>> getMyCompanyList(@Body RequestBody requestBody);

    /**
     * 查询企业关联服务
     */
    @GET("/api/yky/app/order-new/listServiceByCreditNo/{creditNo}")
    Flowable<BaseModel<List<ServiceRecordsModel.ServiceModel>>> getServiceByCreditNo(@Path("creditNo") String creditNo);

    /**
     * 查询订单关联服务
     */
    @GET("/api/yky/app/order-new/listServiceByOrderId/{orderId}")
    Flowable<BaseModel<List<OrderProgressModel>>> getServiceByOrderId(@Path("orderId") String orderId);

    /**
     * 检查是否存在此套餐
     */
    @POST("/api/yky/app/product-info/app/check/product")
    Flowable<BaseModel<CheckComboResponseModel>> checkProduct(@Body RequestBody requestBody);

    /**
     * 获取验证码
     */
    @PUT("/api/yky/app/auth/phone")
    Flowable<BaseModel<VerifyCodeModel>> sendCode(@Body RequestBody requestBody);

    /**
     * 伪token
     */
    @POST("/api/yky/app/auth/phone")
    Flowable<BaseModel<UserModel>> verifyCode(@Body RequestBody requestBody);

    /**
     * 验证验证码(登录)
     */
    @POST("/api/yky/app/user/login")
    Flowable<BaseModel<UserModel>> login(@Body RequestBody requestBody);

    /**
     * 绑定手机号
     */
    @POST("/api/yky/app/user/bindPhone")
    Flowable<BaseModel<UserModel>> bindPhone(@Body RequestBody requestBody);

    /**
     * 重置密码
     */
    @POST("/api/yky/app/user/resetPassWord")
    Flowable<BaseModel<UserModel>> resetPassword(@Body RequestBody requestBody);
}
